package com.hcyy.util;

import java.text.SimpleDateFormat;
import java.util.Date;

public class SidConvertor {
	
	public static String makeSid(String lastSid){
		int num=0;
		String date=new SimpleDateFormat("yyMMdd").format(new Date());
		if(lastSid==null||lastSid.trim()==""||(!lastSid.substring(0, 6).equals(date))){
		}else{
			num=num+Integer.parseInt(lastSid.substring(6));
		}
		num+=1;
		String count="";
		switch((num+"").length())
		{
		case 1:
			count="0000"+num;
			break;
		case 2:
			count="000"+num;
			break;
		case 3:
			count="00"+num;
			break;
		case 4:
			count="0"+num;
			break;
		default:
			count=""+num;
		}
		String sid=new SimpleDateFormat("yyMMdd").format(new Date())+count;
		return sid;
	}
}
